package com.gjy.disruptor.uuid.newd;

import com.gjy.disruptor.uuid.newd.netty.HttpUuidServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author gjy
 * @version 1.0
 * @since 2025-10-11 10:21:37
 */
public class UuidServerApplication {

    private static final Logger logger = LoggerFactory.getLogger(UuidServerApplication.class);

    public static void main(String[] args) {
        int port = 8080;
        if (args.length > 0) {
            try {
                port = Integer.parseInt(args[0]);
            } catch (NumberFormatException e) {
                logger.warn("Invalid port number provided: {}. Using default port 8080.", args[0]);
            }
        }

        try {
            logger.info("端口号为: {}", port);
            new HttpUuidServer(port).run();
        } catch (InterruptedException e) {
            logger.error("Server interrupted", e);
            Thread.currentThread().interrupt();
        } catch (Exception e) {
            logger.error("Server error", e);
        }
    }

}
